package com.jcwx.game.login;

import java.util.HashMap;
import java.util.Map;

import com.alibaba.fastjson.JSONObject;
import com.jcwx.game.domain.AreaInfo;
import com.jcwx.game.domain.LoginPassportInfo;
import com.jcwx.game.domain.RegisterInfo;
import com.jcwx.game.util.BocHttpClient;

/**
 * 登录游戏选择服务器列表
 * 
 * @author csp
 * 
 */
public class GetArea {

	public AreaInfo AreaInfo(RegisterInfo registerInfo,
			LoginPassportInfo loginPassportInfo) {

		String url = "http://192.168.1.250:8881/front/login/app-store-login.action";
		Map<String, String> params = new HashMap<String, String>();
		params.put("token_key", registerInfo.getUid() + "##"
				+ loginPassportInfo.getToken());// "139072##B3EA0E51C06043C7ACE2BFEA9F5B4618");
		String jsonObject = "";
		try {
			jsonObject = BocHttpClient.sendPost(url, params);
			System.out.println(jsonObject);
		} catch (Exception e) {
			e.printStackTrace();
		}

		JSONObject json = JSONObject.parseObject(jsonObject);
		AreaInfo areaInfo = new AreaInfo();
		areaInfo.setToken_key(json.getString("token_key"));

		return areaInfo;
	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {

		GetArea getArea = new GetArea();
		AreaInfo areaInfo = getArea.AreaInfo(null ,null);
		System.out.println(areaInfo.getToken_key());

	}

}
